//
//  JumpUtils.m
//  insurance
//
//  Created by admin on 2023/6/29.
//  Copyright © 2023 王长飞. All rights reserved.
//

#import "JumpUtils.h"
#import "FriendsCodeController.h"
#import "AboutPlatformController.h"
#import "InformationController.h"
#import "ProductDetailController.h"
#import "EFTabBarController.h"
#import "WKWebViewController.h"

@implementation JumpUtils

+ (void)jumpToSecondPage:(EFBaseViewController *)controller firstMenu:(NSString *)firstMenu secondMenu:(NSString *)secondMenu{
    //1资讯 8标准电商 25保险产品 88跳转第三方 100跳第三方App
    if(ISEqual(firstMenu, @"1")){
        InformationController *infoVC = [[InformationController alloc]init];
        infoVC.secondMenu = secondMenu;
        [controller.navigationController pushViewController:infoVC animated:YES];
    }else if(ISEqual(firstMenu, @"25")){
        ProductDetailController *productVC = [[ProductDetailController alloc]init];
        productVC.secondMenu = secondMenu;
        [controller.navigationController pushViewController:productVC animated:YES];
    }
}

+ (void)jumpToOtherPage:(EFBaseViewController *)controller firstMenu:(NSString *)firstMenu secondMenu:(NSString *)secondMenu thirdUrl:(NSString *)thirdUrl{
    //firstMenu 1跳频道 2跳频道分类 3跳个人中心 5协议 88跳第三方
    if(ISEqual(firstMenu, @"1")){
        //second 1跳学习 8跳商城 25跳保险 88跳第三方
        if(ISEqual(secondMenu, @"1")){
//            controller.tabBarController.selectedIndex = 2;
            EFTabBarController *tabBarController = (EFTabBarController *)controller.tabBarController;
            [tabBarController showViewControllerWithTag:2];
        }
    }
    else if(ISEqual(firstMenu, @"2")){
        // 1资讯、8标准电商、25保险产品、88跳第三方
        if(ISEqual(secondMenu, @"1")){
            EFTabBarController *tabBarController = (EFTabBarController *)controller.tabBarController;
            [tabBarController showViewControllerWithTag:2];
        }else if(ISEqual(secondMenu, @"8")){
            EFTabBarController *tabBarController = (EFTabBarController *)controller.tabBarController;
            [tabBarController showViewControllerWithTag:3];
        }else if(ISEqual(secondMenu, @"25")){
            EFTabBarController *tabBarController = (EFTabBarController *)controller.tabBarController;
            [tabBarController showViewControllerWithTag:1];
        }else if(ISEqual(secondMenu, @"88")){
            if(!ISEMPTY(thirdUrl)){
                WKWebViewController *webController = [[WKWebViewController alloc]init];
                webController.titleString = @"详情";
                webController.urlString = thirdUrl;
                [controller.navigationController pushViewController:webController animated:YES];
            }
        }
    }
    else if(ISEqual(firstMenu, @"3")){
        //分享
        if(ISEqual(secondMenu, @"/personalCenter/fenxiaocenter")){
            FriendsCodeController *friendsController = [[FriendsCodeController alloc]init];
            [controller.navigationController pushViewController:friendsController animated:YES];
        }
        //关于平台
        else if(ISEqual(secondMenu, @"/personalCenter/aboutplatform")){
            AboutPlatformController *aboutController = [[AboutPlatformController alloc]init];
            [controller.navigationController pushViewController:aboutController animated:YES];
        }
    }
}
@end
